import http from "@/network/http"
import { TreasuryTask } from "@/store/treasurySlice"

export const createTask = (params: TreasuryTask) => {
  return http.post({
    url: '/task/save',
    data: params
  })
}

export interface TreasuryTaskDetail extends TreasuryTask {
  submitCount: number
} 


export const getTreasuryTaskDetail = (treasuryTaskId: number): Promise<TreasuryTaskDetail> => {
  return http.get({
    url: '/task/detail',
    data: { treasuryTaskId }
  })
}

export interface SubmitTaskParams {
  treasuryTaskId: number
  note: string
  image: string
}

export const submitTask = (params: SubmitTaskParams) => {
  return http.post({
    url: '/task/submit',
    data: params
  })
}